<?php
$currentUser = User::getLogedInUser();
if ($currentUser->teamId != 2) { //pulse Team 
    header('HTTP/1.0 404 Not Found');
    echo "<style>
		body {background: #f9fee8;margin: 0; padding: 20px; text-align:center; font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#666666;}
		.error_page {width: 600px; padding: 50px; margin: auto;}
		.error_page h1 {margin: 20px 0 0;}
		.error_page p {margin: 10px 0; padding: 0;}		
		a {color: #9caa6d; text-decoration:none;}
		a:hover {color: #9caa6d; text-decoration:underline;}
		</style><body class=\"login\">
  <div class=\"error_page\">
    <img alt=\"Kidmondo_face_sad\" src=\"/Images/kidmondo_face_sad.gif\">
    <h1>We're sorry...</h1>
    <p>The page or journal you are looking for cannot be found.</p>
    <p><a href=\"http://pulse.buzzmetrics.vn\">Return to the homepage</a></p>
  </div>

</body>";
    exit(0);
}
if (isset($_POST['user'])) {
    session_start();
    $_SESSION['userid'] = $_POST['user'];
    session_write_close();
    header("Location: /");
}
?>
<html>
    <head>
        <title>Switch User</title>
        <link type="text/css" rel="stylesheet" href="CSS/Desktop/login.css"/>
    </head>
    <body>
        <div class="login-container">
            <a href="#" class="logo">
                <img class="logoimage" src="Images/logo_beta.png" witdh="250px"/>
            </a>
            <form name="login" method="POST">
                <label>Select a client account:</label>
                <select name="user" id="client-account" style="border:0;padding: 4px; width: 170px; font-size: 12pt">
                    <?php
                    $users = User::getClientAccounts();
                    foreach ($users as $user) :
                        ?>
                        <option value="<?php echo $user->id ?>"><?php echo $user->name . ' &lt;' . $user->email .'&gt; | '.$user->company ?></option>
                    <?php endforeach; ?>
                </select>
                <div class="btn-holder" style="margin-top: 5px; float: none"><input type="submit" class="btn btn-red" value="Switch"></div>       
            </form>
        </div>
    </body>
</html>